package com.cssw.fyzb.busi.api.user;

//import com.sw.fyzb.busi.service.user.UserLevelService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Feng Chen
 */
@Function(description = "更新用户级别定义", parameters = {
        @Parameter(name = "id", type = Type.Integer, description = "级别编号", required = true),
        @Parameter(name = "name", type = Type.String, description = "级别名称", required = false),
        @Parameter(name = "ratio", type = Type.Integer, description = "交易手续费比列", required = false),
        @Parameter(name = "condition", type = Type.String, description = "升级条件", required = false)
})
@Component
public class UpdateUserLevel implements Action {

    @Autowired
//    private UserLevelService userLevelService;

    private static final Logger logger = LoggerFactory.getLogger(UpdateUserLevel.class);

    @Override
    public Response execute(Request request) throws Exception {
        Integer id = request.getInteger("id");
        String name = request.getString("name");
        Integer ratio = request.getInteger("ratio");
        String codition = request.getString("condition");
        try {
//            userLevelService.update(id, name, ratio, codition);
            return Response.success();
        } catch (Exception e) {
            logger.error("", e);
            return Response.fail("更新用户等级定义失败");
        }
    }

}
